<template>
    <view class="popup-c-2847 data-v-50ae3779">
        <view class="share-type-c safe-area-bottom data-v-50ae3779" v-if="isAskShareType">
            <view class="title-text data-v-50ae3779">分享至</view>
            <view class="list-popup data-v-50ae3779">
                <button @tap="__e" class="item data-v-50ae3779" :data-event-opts="[['tap', [['shareToWechat', ['$event']]]]]" openType="share">
                    <image class="data-v-50ae3779" mode="widthFix" src="https://cdn2.hquesoft.com/box/img/wechat.png"></image>
                    <view class="text data-v-50ae3779">微信好友</view>
                </button>
                <button @tap="__e" class="item data-v-50ae3779" :data-event-opts="[['tap', [['shareToTimeLine', ['$event']]]]]" v-if="isCanShareToTimeLine">
                    <image class="data-v-50ae3779" mode="widthFix" src="https://cdn2.hquesoft.com/box/img/timeline.png"></image>
                    <view class="text data-v-50ae3779">朋友圈</view>
                </button>
                <button @tap="__e" class="item data-v-50ae3779" :data-event-opts="[['tap', [['generatePoster', ['$event']]]]]" v-if="isCanShareWithPoster && poster">
                    <image class="data-v-50ae3779" mode="widthFix" src="https://cdn2.hquesoft.com/box/img/image.png"></image>
                    <view class="text data-v-50ae3779">生成海报</view>
                </button>
            </view>
            <view @tap="__e" class="cancel-text data-v-50ae3779" :data-event-opts="[['tap', [['close', ['$event']]]]]">取消</view>
        </view>
        <view class="poster-content data-v-50ae3779" v-if="isShowPoster">
            <view @tap="__e" class="close-btn data-v-50ae3779" :data-event-opts="[['tap', [['close', ['$event']]]]]">
                <text class="new-iconfont icon-close data-v-50ae3779"></text>
            </view>
            <poster-theme1
                @__l="__l($event, { eventOpts: [['^getPosterUrl', [['getPosterUrl']]]] })"
                @getPosterUrl="__e($event, { eventOpts: [['^getPosterUrl', [['getPosterUrl']]]] })"
                class="data-v-50ae3779"
                :data-event-opts="[['^getPosterUrl', [['getPosterUrl']]]]"
                :info="calcInfo"
                vueId="34d9c03c-1"
            ></poster-theme1>
            <view @tap.stop.prevent="__e" class="button-c data-v-50ae3779" :data-event-opts="[['tap', [['prevent', ['$event']]]]]">
                <button @tap="__e" class="data-v-50ae3779" :data-event-opts="[['tap', [['saveImg', ['$event']]]]]" hoverClass="hover">保存海报至相册</button>
            </view>
        </view>
    </view>
</template>

<script>
import posterTheme1 from '@/components/SharePopup/components/posterTheme1';
import tabBar from '@/components/TabBar/tabBar';
(global.webpackJsonp = global.webpackJsonp || []).push([
    ['components/SharePopup/SharePopup'],
    {
        '04d4': function (e, t, n) {
            'use strict';

            n.d(t, 'b', function () {
                return o;
            });
            n.d(t, 'c', function () {
                return r;
            });
            n.d(t, 'a', function () {});
            var o = function () {
                this.$createElement;
                this._self._c;
            };
            var r = [];
        },
        '0cb5': function (e, t, n) {
            'use strict';

            var o = n('eeec');
            n.n(o).a;
        },
        '8d2d': function (e, t, n) {
            'use strict';

            n.r(t);
            var o = n('c00b');
            var r = n.n(o);
            for (var i in o) {
                if (['default'].indexOf(i) < 0) {
                    (function (e) {
                        n.d(t, e, function () {
                            return o[e];
                        });
                    })(i);
                }
            }
            t.default = r.a;
        },
        b677: function (e, t, n) {
            'use strict';

            n.r(t);
            var o = n('04d4');
            var r = n('8d2d');
            for (var i in r) {
                if (['default'].indexOf(i) < 0) {
                    (function (e) {
                        n.d(t, e, function () {
                            return r[e];
                        });
                    })(i);
                }
            }
            n('0cb5');
            var c = n('f0c5');
            var s = Object(c.a)(r.default, o.b, o.c, false, null, '50ae3779', null, false, o.a, void 0);
            t.default = s.exports;
        },
        c00b: function (e, t, n) {
            'use strict';

            (function (e) {
                var o = n('4ea4');
                Object.defineProperty(t, '__esModule', {
                    value: true
                });
                t.default = void 0;
                var r = o(n('9523'));
                var i = n('2684');
                function c(e, t) {
                    var n = Object.keys(e);
                    if (Object.getOwnPropertySymbols) {
                        var o = Object.getOwnPropertySymbols(e);
                        if (t) {
                            o = o.filter(function (t) {
                                return Object.getOwnPropertyDescriptor(e, t).enumerable;
                            });
                        }
                        n.push.apply(n, o);
                    }
                    return n;
                }
                function s(e) {
                    for (var t = 1; t < arguments.length; t++) {
                        if (null != arguments[t]) {
                            var n = arguments[t];
                        } else {
                            var n = {};
                        }
                        if (t % 2) {
                            c(Object(n), true).forEach(function (t) {
                                (0, r.default)(e, t, n[t]);
                            });
                        } else {
                            Object.getOwnPropertyDescriptors
                                ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n))
                                : c(Object(n)).forEach(function (t) {
                                      Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
                                  });
                        }
                    }
                    return e;
                }
                var a = {
                    components: {
                        PosterTheme1: function () {
                            Promise.all([n.e('common/vendor'), n.e('components/SharePopup/components/posterTheme1')])
                                .then(
                                    function () {
                                        return resolve(n('04ac'));
                                    }.bind(null, n)
                                )
                                .catch(n.oe);
                        }
                    },
                    props: {
                        info: {
                            type: Object,
                            default: function () {
                                return {};
                            }
                        },
                        poster: {
                            type: Boolean,
                            default: function () {
                                return true;
                            }
                        }
                    },
                    computed: {
                        calcInfo: function () {
                            return s(
                                s({}, this.info),
                                {},
                                {
                                    qrcode: i.BASE_URL + '/miniapp/qrcode?path=' + encodeURIComponent(this.info.path)
                                }
                            );
                        },
                        isCanShareToTimeLine: function () {
                            return false;
                        },
                        isCanShareWithPoster: function () {
                            return true;
                        }
                    },
                    data: function () {
                        return {
                            image: '',
                            isShowPoster: false,
                            isAskShareType: true
                        };
                    },
                    methods: {
                        shareToWechat: function () {
                            this.close();
                            if (0 == this.poster) {
                                this.$http('/task/add_share', 'POST')
                                    .then(function (e) {})
                                    .catch(function (e) {
                                        console.log(e);
                                    });
                            }
                            return false;
                        },
                        shareToTimeLine: function () {
                            var that = this;
                            e.share({
                                provider: 'weixin',
                                scene: 'WXSceneTimeline',
                                type: 0,
                                href: this.info.app_url,
                                title: this.info.title,
                                imageUrl: this.info.thumb,
                                summary: this.info.desc || this.info.title,
                                success: function (e) {
                                    that.close();
                                },
                                fail: function (t) {
                                    console.log('fail:' + JSON.stringify(t));
                                    e.showToast({
                                        title: '分享未成功~'
                                    });
                                }
                            });
                        },
                        generatePoster: function () {
                            this.isAskShareType = false;
                            this.isShowPoster = true;
                        },
                        getPosterUrl: function (e) {
                            this.image = e;
                        },
                        close: function () {
                            this.$emit('close');
                        },
                        saveImg: function () {
                            e.saveImageToPhotosAlbum({
                                filePath: this.image,
                                success: function (t) {
                                    e.showToast({
                                        title: '已保存到相册',
                                        icon: 'none'
                                    });
                                }
                            });
                        }
                    }
                };
                t.default = a;
            }.call(this, n('543d').default));
        },
        eeec: function (e, t, n) {}
    }
]);
(global.webpackJsonp = global.webpackJsonp || []).push([
    'components/SharePopup/SharePopup-create-component',
    {
        'components/SharePopup/SharePopup-create-component': function (e, t, n) {
            n('543d').createComponent(n('b677'));
        }
    },
    [['components/SharePopup/SharePopup-create-component']]
]);
</script>
<style>
@import './SharePopup.css';
</style>
